<?php

namespace app\common\model;

use think\Model;

class Video extends Model
{
    static function add_one($info){
        return self::insertGetId($info);
    }

     static function getTimeMp4($uId,$time){
	//var_dump(bcsub($time,180));
	//var_dump($time);
	$data =   self::where([['uId' , '=',$uId],['start_time','>=',bcsub($time,180)],['end_time','<=',bcadd($time,120)]])->select()->toArray();
	//echo self::where([['uId' , '=',$uId],['start_time','>=',bcsub($time,180)],['end_time','<=',bcadd($time,120)]]])->getlastsql();
	if(!$data) return '';
	$data = (array)$data;
	$nData = [];
	foreach($data as $value){
		$newData['video_url'] = $value['video_url'];
		$newData['start_time'] = date('Y-m-d H:i:s',$value['start_time']);
		$newData['end_time'] = date('Y-m-d H:i:s',$value['end_time']);
		$nData[] = $newData;
        }
//	$data = array_column($data,'video_url');
	return $nData;
    }


}
